<template>
  <div>
    <template>
      <el-table width="100%" height="800px" :data="videoInfos">
        <el-table-column prop="frameUrl" label="封面" width="300" align="center">
          <template slot-scope="scope">
            <img :src="scope.row.frameUrl" alt="" style="width:100%;height:100%">
          </template>
        </el-table-column>
        <el-table-column prop="description" label="简介" header-align="center">
        </el-table-column>
      </el-table>
    </template>


  </div>
</template>

<script>
  import axios from "axios";

  export default {
    data() {
      return {
        videoInfos: []
      }
    },

    methods: {
      getSubmitVideos: function () {
        axios.get("/video/get_videos", {
          params: {"uid": JSON.parse(sessionStorage.getItem("userInfo")).uid }
        }).then(res=>{
          if (res.data.code === 0) {
            for (let i = 0; i < res.data.data.length; i++) {
              this.videoInfos.push(res.data.data[i])
              axios.get('video/get_frame_url', {
                params: {"videoId": this.videoInfos[i].videoId}
              }).then(r=>{
                if (r.data.code === 0) {
                  this.videoInfos[i].frameUrl = r.data.data[0]
                }
              })
            }
          } else alert(res.data.errMessage)
        })
        console.log(this.videoInfos)
      }
    },
    created() {
      this.getSubmitVideos()
    },
    mounted() {
    }
  }
</script>

<style>
</style>
